#include<iostream>
#include<vector>
#include<string>
#include<cstdio>
using namespace std;

void myPrint(vector<int> a)
{
	for(vector<int>::iterator it = a.begin();it!=a.end();it++)//正向遍历迭代器iterator
	{
   		cout<<(*it)<<" ";	
	}
	cout<<endl;
}
void reversePrint(vector<int> a)
{
	for(vector<int>::reverse_iterator itr = a.rbegin();itr!=a.rend();itr++)//反向遍历迭代器reverse_iterator
	{
		cout<<(*itr)<<" ";
	}
	cout<<endl;
}
int main(){
   	vector<int> s1(10);
   	vector<int> s2;
   	vector<int> s3(s1);
   	vector<int> s4;
   	vector<char> op(5,'c');
   	
   	//insert必须和begin,end等函数配套，不可以使用纯数字
   	op.insert(op.begin(),'a');
   	op.insert(op.begin()+1,2,'b');
   	op.erase(op.begin()+1,op.end()-1);
   	for(vector<char>::iterator it = op.begin();it!=op.end();it++)
   	{
   		cout<<(*it)<<" ";	
	}
 	cout<<endl;
   	s1.pop_back();
   	s2.assign(5,6); //赋值函数，将5个6赋值给容器
   	s2.push_back(2);
   	s3.push_back(10);
   	for(int i=0;i<10;i++)
   	{
   		s4.push_back(i+1);
	}
   	myPrint(s4);
   	reversePrint(s4);
   	myPrint(s1);
   	myPrint(s2);
   	cout<<s2.front()<<endl;
   	cout<<s2.back()<<endl;
   	myPrint(s3);
   	cout<<s3.at(10)<<endl;
   	
    return 0;
}